package com.grp6.game.chess;

import java.util.List;

import com.grp6.game.chess.model.ChessGameBoard;
import com.grp6.game.chess.model.ChessGameModel;
import com.grp6.game.chess.player.ChessComputerPlayer;
import com.grp6.game.chess.player.ChessHumanPlayer;
import com.grp6.game.chess.player.IChessPlayer;
import com.grp6.game.controller.IAbstractGameFactory;
import com.grp6.game.model.IGameBoard;
import com.grp6.game.model.IGameModel;
import com.grp6.game.player.IPlayer;
import com.grp6.game.settings.IPreferences;
import com.grp6.game.ui.platform.IAbstractUIPlatformFactory;

public class ChessGameFactory implements IAbstractGameFactory{

	@Override
	public ChessGameLifecycle createLifecycle(IGameModel gameModel) {
		return new ChessGameLifecycle((ChessGameModel) gameModel);
	}

	@Override
	public ChessPreferences createPreferences(IAbstractUIPlatformFactory uifac) {
		return new ChessPreferences(uifac);
	}

	@Override
	public ChessGameBuilder createGameBuilder(IAbstractUIPlatformFactory uifac) {
		return  new ChessGameBuilder(uifac,this);
	}

	@SuppressWarnings("unchecked")
	@Override
	public <P extends IPlayer> ChessGameModel createGameModel(IGameBoard board,List<P> players) {
		return new ChessGameModel((ChessGameBoard)board,(List<IChessPlayer>) players);
	}

	@Override
	public ChessHumanPlayer createHumanPlayer() {
		return new ChessHumanPlayer();
	}

	@Override
	public ChessComputerPlayer createComputerPlayer() {
		return new ChessComputerPlayer();
	}

	@Override
	public ChessGameBoard createGameBoard(IPreferences preferences) {
		return new ChessGameBoard();
	}

}
